<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>费率记录表</title>
    <link rel="stylesheet" href="../../../../start/layui/css/layui.css" media="all">
</head>
<body>
<div class="layui-fluid" style="padding: 15px">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    费率表
                </div>
                <div class="layui-card-body">
                    <table id="price" lay-filter="testPrice"></table>
                </div>
            </div>
        </div>
    </div>

</div>
<!--右边工具栏-->
<script type="text/html" id="barDemoMenu">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">启用</a>
</script>


<script src="../../../../start/layui/layui.js"></script>
<script>
    layui.use('table', function(){
        var  $ = layui.$
            ,table = layui.table;
        //用于显示添加还是修改的
        var show=""

        //菜单表格
        table.render({
            elem: '#price'
            ,height: 500
            ,url: '../../../../PriceList' //数据接口
            ,limit:5
            ,limits:[5,10,15,20]
            ,page: true //开启分页
            ,cols: [[ //表头
                ,{field: 'priceId', title: 'ID', sort: true ,width:"85"}
                ,{field: 'pickupcharge', title: '提货费',width:"90"}
                ,{field: 'deliveryexpense', title: '送货费',width:"90"}
                ,{field: 'premium', title: '保价',width:"90"}
                ,{field: 'landingcharges', title: '卸货费',width:"90"}
                ,{field: 'initiatemode', title: '是否启用',width:"90"}
                ,{field: 'remark', title: '备注信息',width:"100"}
                ,{fixed: 'right', title:'操作', toolbar: '#barDemoMenu',width:"100"}
            ]]
        });


        //监听用户行工具事件
        table.on('tool(testPrice)', function(obj){
            var data = obj.data;
            /*启用*/
            if(obj.event === 'del'){
                $.ajax({
                    type: "POST",
                    url:  '../../../../PriceUpdate?priceId='+data.priceId,
                    dataType: "text",
                    success: function(data){
                        table.reload('price');
                        layer.msg('启用'+data+',...');
                    }
                });
            }
        });

    });
</script>
</body>
</html>